@extends('layouts.master')

@section('title')
    Grupos
@stop

@section('content')
<div class="row">
	<div class="col-lg-12">
		<section class="panel">
            <div class="table-responsive">
				<table class="table table-striped m-b-none" data-ride="datatables">
					<thead>
						<tr>
							<th>ID</th>
							<th>Nombre</th>
							<th>Jugadores miembro</th>
							<th>Actions</th>
						</tr>
					</thead>
					<tbody>
					<!-- display stored groups -->
					@foreach($groups as $key => $value)
						<tr>
							<td>{{ $value->id }}</td>
							<td>{{ $value->name }}</td>
							<td>{{ $value->users->count() }}</td>
							
							<!-- we will also add show, edit, and delete buttons -->
							<td>
								<a class="btn btn-small btn-success" href="{{ URL::to('groups/' . $value->id) }}">Ver</a>
							</td>
						</tr>
					@endforeach
					</tbody>
				</table>
            </div>
    	</section>
	</div>
</div>
@stop

@section('scripts')
<script type="text/javascript">
	// datatable
	$('[data-ride="datatables"]').each(function() {
		var oTable = $(this).dataTable( {
			"sDom": "<'row'<'col-sm-6'l><'col-sm-6'f>r>t<'row'<'col-sm-6'i><'col col-sm-6'p>>",
			"sPaginationType": "full_numbers",
			"language": {
	            "lengthMenu": "Mostrar _MENU_ registros por página",
	            "zeroRecords": "No se encontraron resultados",
	            "info": "Mostrando página _PAGE_ de _PAGES_",
	            "infoEmpty": "No hay datos para mostrar",
	            "infoFiltered": "(filtrado de un total de _MAX_ registros)"
	        },
	        "aoColumnDefs": [
		                       {
		                          bSortable: false,
		                          aTargets: [ -1 ]
		                       }
		                     ]
		} );
	});
</script>
@stop